//
//  DetailViewController.m
//  StationManager
//
//  Created by 张佳强 on 17/3/7.
//  Copyright © 2017年 Helong. All rights reserved.
//

#import "DetailViewController.h"
#import "DetailTableView.h"
#import "StationInfoModel.h"
@interface DetailViewController ()<UIScrollViewDelegate>

//顶部背景View
@property (nonatomic,strong) UIView * bgView;
//下划线
@property (strong,nonatomic) UILabel * baseLine;
//故障信息按钮Button
@property (nonatomic,strong) UIButton * damageButton;
//紧急信息按钮Button
@property (nonatomic,strong) UIButton * urgencyButton;
//ScrollView
@property (strong,nonatomic) UIScrollView * scrollView;
//运维信息按钮Button
@property (nonatomic,strong) UIButton * operationButton;
//故障台站数据列表TableView
@property (nonatomic,strong) DetailTableView * damageTableView;
//紧急台站数据列表TableView
@property (nonatomic,strong) DetailTableView * urgencyTableView;
//运维台站数据列表TableView
@property (nonatomic,strong) DetailTableView * operationTableView;

@end

@implementation DetailViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationItem.title = @"故障台站信息";
    [self setUI];
}

//设置UI
- (void)setUI {
    
//    self.bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)];
//    self.bgView.backgroundColor = [UIColor colorWithRed:34/255.0 green:150/255.0 blue:243/255.0 alpha:1.0];
//    [self.view addSubview:self.bgView];
//    
//    self.urgencyButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.urgencyButton.frame = CGRectMake(SCREEN_WIDTH/3, 0, SCREEN_WIDTH/3, 39);
//    self.urgencyButton.backgroundColor = [UIColor whiteColor];
//    [self.urgencyButton setTitle:@"紧急台站信息" forState:UIControlStateNormal];
//    [self.urgencyButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.urgencyButton setTitleColor:[UIColor colorWithRed:34/255.0 green:150/255.0 blue:243/255.0 alpha:1.0] forState:UIControlStateSelected];
//    self.urgencyButton.titleLabel.font = [UIFont systemFontOfSize:13.0];
//    [self.urgencyButton addTarget:self action:@selector(urgencyClick) forControlEvents:UIControlEventTouchUpInside];
//    [self.bgView addSubview:self.urgencyButton];
//    
//    self.operationButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.operationButton.frame = CGRectMake(SCREEN_WIDTH/3*2, 0, SCREEN_WIDTH/3, 39);
//    self.operationButton.backgroundColor = [UIColor whiteColor];
//    [self.operationButton setTitle:@"任务台站信息" forState:UIControlStateNormal];
//    [self.operationButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.operationButton setTitleColor:[UIColor colorWithRed:34/255.0 green:150/255.0 blue:243/255.0 alpha:1.0] forState:UIControlStateSelected];
//    self.operationButton.titleLabel.font = [UIFont systemFontOfSize:13.0];
//    [self.operationButton addTarget:self action:@selector(operationClick)    forControlEvents:UIControlEventTouchUpInside];
//    [self.bgView addSubview:self.operationButton];
//    
//    self.damageButton = [UIButton buttonWithType:UIButtonTypeCustom];
//    self.damageButton.frame = CGRectMake(0, 0, SCREEN_WIDTH/3, 39);
//    self.damageButton.backgroundColor = [UIColor whiteColor];
//    [self.damageButton setTitle:@"故障台站信息" forState:UIControlStateNormal];
//    [self.damageButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [self.damageButton setTitleColor:[UIColor colorWithRed:34/255.0 green:150/255.0 blue:243/255.0 alpha:1.0] forState:UIControlStateSelected];
//    self.damageButton.titleLabel.font = [UIFont systemFontOfSize:13.0];
//    [self.damageButton addTarget:self action:@selector(damageClick) forControlEvents:UIControlEventTouchUpInside];
//    self.damageButton.selected = YES;
//    [self.bgView addSubview:self.damageButton];
//    
//    _baseLine = [[UILabel alloc]initWithFrame:CGRectMake(0, 37, SCREEN_WIDTH/3, 3)];
//    _baseLine.backgroundColor = [UIColor colorWithRed:34/255.0 green:150/255.0 blue:243/255.0 alpha:1.0];
//    [self.bgView addSubview:_baseLine];
//    
//    _scrollView = [[UIScrollView alloc] init];
//    _scrollView.contentSize = CGSizeMake(SCREEN_WIDTH*3, 0);
//    _scrollView.contentOffset = CGPointMake(0, 0);
//    _scrollView.bounces = NO;
//    _scrollView.pagingEnabled = YES;
//    _scrollView.backgroundColor = WHITECOLOR;
//    _scrollView.showsHorizontalScrollIndicator = NO;
//    _scrollView.delegate = self;
//    [self.view addSubview:_scrollView];
//    
//    [_scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.view).offset(47*hl);
//        make.left.right.equalTo(self.view);
//        make.bottom.equalTo(self.view).offset(-1*hl);
//    }];
//    
    self.damageTableView = [[DetailTableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-64) style:UITableViewStyleGrouped];
    self.damageTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
    self.damageTableView.dataArray = self.damageArray;
    self.damageTableView.userLongitude = self.userLongitude;
    self.damageTableView.userLatitude = self.userLatitude;
    [self.view addSubview:self.damageTableView];
    
  
    
//    self.urgencyTableView = [[DetailTableView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH, 0, SCREEN_WIDTH, SCREEN_HEIGHT-105) style:UITableViewStyleGrouped];
//    self.urgencyTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
//    self.urgencyTableView.dataArray = self.urgencyArray;
//    self.urgencyTableView.userLongitude = self.userLongitude;
//    self.urgencyTableView.userLatitude = self.userLatitude;
//    [self.scrollView addSubview:self.urgencyTableView];
//    self.operationTableView = [[DetailTableView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH*2, 0, SCREEN_WIDTH, SCREEN_HEIGHT-105) style:UITableViewStyleGrouped];
//    self.operationTableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
//    self.operationTableView.dataArray = self.operationArray;
//    self.operationTableView.userLongitude = self.userLongitude;
//    self.operationTableView.userLatitude = self.userLatitude;
//    [self.scrollView addSubview:self.operationTableView];
//    
}
//
////点击紧急信息按钮
//- (void)urgencyClick {
//    
//    self.damageButton.selected = NO;
//    self.urgencyButton.selected = YES;
//    self.operationButton.selected = NO;
//    [UIView animateWithDuration:0.2 animations:^{
//        self.scrollView.contentOffset = CGPointMake(SCREEN_WIDTH, 0);
//        _baseLine.frame = CGRectMake(SCREEN_WIDTH/3, 37, SCREEN_WIDTH/3, 3);
//        
//    }];
//}
//
////点击运维信息按钮
//- (void)operationClick {
//    
//    self.damageButton.selected = NO;
//    self.urgencyButton.selected = NO;
//    self.operationButton.selected = YES;
//    [UIView animateWithDuration:0.2 animations:^{
//        self.scrollView.contentOffset = CGPointMake(SCREEN_WIDTH*2, 0);
//        _baseLine.frame = CGRectMake(SCREEN_WIDTH/3*2, 37, SCREEN_WIDTH/3, 3);
//        
//    }];
//}
//
////点击故障信息按钮
//- (void)damageClick {
//    
//    self.damageButton.selected = YES;
//    self.urgencyButton.selected = NO;
//    self.operationButton.selected = NO;
//    [UIView animateWithDuration:0.2 animations:^{
//        self.scrollView.contentOffset = CGPointMake(0, 0);
//        _baseLine.frame = CGRectMake(0, 37, SCREEN_WIDTH/3, 3);
//        
//    }];
//}
//
//#pragma mark ScrollView - Delegate
//
//- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
//    
//    int i = scrollView.contentOffset.x/SCREEN_WIDTH;
//    if (i == 0) {
//        _urgencyButton.selected = NO;
//        _operationButton.selected = NO;
//        _damageButton.selected = YES;
//        [UIView animateWithDuration:0.1 animations:^{
//            _baseLine.frame = CGRectMake(0, 37, SCREEN_WIDTH/3, 3);
//            
//        }];
//        
//    }else if(i == 1){
//        _urgencyButton.selected = YES;
//        _operationButton.selected = NO;
//        _damageButton.selected = NO;
//        [UIView animateWithDuration:0.1 animations:^{
//            _baseLine.frame = CGRectMake(SCREEN_WIDTH/3, 37, SCREEN_WIDTH/3, 3);
//            
//        }];
//        
//    }else{
//        _urgencyButton.selected = NO;
//        _operationButton.selected = YES;
//        _damageButton.selected = NO;
//        [UIView animateWithDuration:0.1 animations:^{
//            _baseLine.frame = CGRectMake(SCREEN_WIDTH/3*2, 37, SCREEN_WIDTH/3, 3);
//            
//        }];
//    }
//}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end
